package wk.coral.core.enums;

import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils;
import wk.coral.entity.config.PropertiesConfigEntity;

import java.io.File;
import java.io.IOException;

/**
 * description:
 * date 2021-01-17 16:24
 *
 * @author Administrator
 * @version 1.0
 */

@Slf4j
public enum RunEnum {

    HCSD(){
        @Override
        public void run(PropertiesConfigEntity configEntity) {
            try {
                String outPath = configEntity.getOutPath();
                FileUtils.touch(new File(outPath+File.separator+"hcsd.txt"));
            } catch (IOException e) {
                log.error("create file faild :{}",e.getMessage(),e);
            }
        }
    },
    EMKM(){
        @Override
        public void run(PropertiesConfigEntity configEntity) {
            try {
                String outPath = configEntity.getOutPath();
                FileUtils.touch(new File(outPath+"edkm.txt"));
            } catch (IOException e) {
                log.error("create file faild :{}",e.getMessage(),e);
            }
        }
    };

    public abstract void run(PropertiesConfigEntity configEntity);
}
